package
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.MovieClip;

	
	public class StateDrawLoadedImage extends State
	{
		[Embed(source="Untitled-1.swf")]
		public var EmbedMovie:Class;
		//[Embed(source="Board.swf")]
		//public var EmbedBoard:Class;
		
		protected var objects:Array = new Array();
		protected var movie:MovieClip;
		protected var board:MovieClip;
		public function StateDrawLoadedImage()
		{
			super();
			//FBGame.stateStack.Pop();
		}
		public override function Render(g:MyGraphics):void
		{
			g.Clear(0xFF000000);
			//if(objects.length == 2)
			//{
				g.DrawBitmapData(0,0,(Bitmap)(objects[0]).bitmapData);
				//g.DrawBitmapData(200,200,(Bitmap)(objects[1]).bitmapData);
			//}
			g.DrawMovieClip(0,0,movie);
			try
			{
				//objects[1].board.txtData.text = "XXXXXXXX";
				//g.DrawMovieClip(0,0,objects[1]);
			}
			catch(e:Error)
			{
				g.DrawString(e.message,0,0,0xFF000000);
			}

		}
		static var count:int = 0;
		public override function Update(dt:int):void
		{
			//objects[2].board.txtData.text = "CSDF";
			if(count == 0)
			{
				count++;
				FBGame.stateStack.Push(new StatePopupSample(objects[1]));
			}
		}
		public override function Init():void
		{
			movie = new EmbedMovie();
			//FBGame.mainFBGame.addChild(board);
			//var theStage:MovieClip= board.root as MovieClip;
			//theStage.board.txtData.text = "CSDF";
			//board.SetText("AGDKDGK");
			//board.root.SetText("ADFDA");
			
			var s:Vector.<ExternalResource> = new Vector.<ExternalResource>();
			s.push(new ExternalResource("http://aagntw29.facebook.joyent.us/game/Kem.jpg",ExternalResource.image));
			//s.push("http://aagntw29.facebook.joyent.us/game/Xoi.png");
			s.push(new ExternalResource("http://aagntw29.facebook.joyent.us/game/Board.swf",ExternalResource.movieClip));
			FBGame.stateStack.Push(new StateLoading(s,objects));
		}
		public override function Release():void
		{
			
		}
	}
}